package top.dingyingying.springboot3.exam;

import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import top.dingyingying.springboot3.annotation.Limit;
import top.dingyingying.springboot3.base.PageBean;
import top.dingyingying.springboot3.base.R;
import top.dingyingying.springboot3.validate.CommonValidate;
import top.dingyingying.springboot3.vo.PageVo;

@RestController
@RequestMapping("/examinfo")
@RequiredArgsConstructor
public class TbExamInfoController {
    private final TbExamInfoService tbExamInfoService;


    @PostMapping("")
    public R<String> insert(@RequestBody @Validated(CommonValidate.Add.class) TbExamInfo tbExamInfo){
        return tbExamInfoService.insert(tbExamInfo);
    }
    @GetMapping("/{ps}/{pn}")
    public R<PageVo<TbExamInfo>> query(TbExamInfo tbExamInfo,@PathVariable("ps")Long ps,@PathVariable("pn")Long pn,  PageBean pageBean){
        return tbExamInfoService.query(tbExamInfo, pageBean.instance(ps, pn));
    }
    @DeleteMapping("/{id}")
    public R<String> delete(@PathVariable("id") Integer id){
        return null;
    }
}
